package typeErasure.genericArray;

public class Main<T> {

    public T create(Class<T> type) {
        try {
            return type.newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
        return null;
    }


    public static void main(String[] args) {
//        Main<String> m = new Main<String>();
//        String s = m.create(String.class);
//        System.out.println(s.getClass());

        Main<Integer> m2 = new Main<Integer>();
        Integer i = m2.create(Integer.class);
        System.out.println(i.getClass());
    }

}
